home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1995 October
/
EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso
/
Aminet
/
comm
/
mail
/
BounceIt.lha
/
BounceIt.rexx
< prev
Wrap
OS/2 REXX Batch file
|
1995-04-17
|
5KB
|
173 lines
/******************************************************************************
BounceIt V1.00
Copyright © 1995 by Greg Patterson
This program scans your inbound UUMAIL: directory for mail delivered to your
site. It uses a very simple configuration file in amitcp:db/bounce.config upon
startup. Any files found in the UUMAIL: directory which are not listed in this
configuration file will be bounced to a destination email address.
For example, on my system, I have Sabot setup to alert me to any incoming email
for the userid's "root" or "christina". If I receive email on any other
address on my machine, it will often stay around for days without being
noticed.
Using this program, I have placed the above userid's in my
amitcp:db/bounce.config file. Any emails sent to userid's not listed in the
configuration file get automatically bounced to "root" (or BouncerDest) when
this program is run.
Set this program up to be run from a CRON utility or possibly in-conjunction
with the Sabot utility.
File layout of amitcp:db/bounce.config:
+--- File format ---
|root
|christina
+-------------------
Nothing fancy! Do not place spaces before or after each line and make sure
you don't put any blank lines in the configuration file. This program does
little or no error checking!
Description of configuration variables below:
BouncerCmd:
Your mailer command (usually Elm). Whatever you use must put From:, To:
and Subject: headers (ie. don't use SMTPPost!). It must also accept input
from stdin. You may need to modify other parameters which are customized
specifically for Elm. Refer to the source code.
BouncerId:
UserId which initiates the sending of the bounced email.
BouncerDest:
UserId to send the bounced email to.
BouncerSubject:
Subject for each bounced email.
BouncerDir:
Directory which is to be checked for bounced email. Append a slash (/)
to the directory name if necessary (ie. if the last character is not a
colon).
BouncerKill:
If this variable is set to "1", it will delete any files found in the
BouncerDir ending in ".o" extension. These files are backup files
created by Elm.
Requirements:
This program has been hard-coded to use Amiga ELM. I don't know of any
other programs which may be used. Configure this yourself as necessary.
Obviously you need ARexx.
Configuration file in AmiTCP:db/bounce.config must exist.
##############################################################
Contact Information:
Email: root@wizard.hip.cam.org
wizard@cam.org
Mailing address:
4770 Linton Street Appt #5
Montreal, Quebec
Canada H3W 1K1
##############################################################
Disclaimer:
NO WARRANTIES ARE MADE. USE OF THIS PROGRAM IS AT YOUR OWN RISK. NO
LIABILITY OR RESPONSIBILITY IS ASSUMED.
******************************************************************************/
Options FailAt 100
BouncerCmd = "AmiTCP:bin/Elm"
BouncerId = "postmaster"
BouncerDest = "root"
BouncerSubject = "Bounced Email"
BouncerDir = "UUMail:"
BouncerKill = 1
/* Open configuration file. */
if ~Open('Fp', 'AMITCP:db/bounce.config', 'Read') then do
say "Error: Unable to open configuration file 'AmiTCP:db/bounce.config'"
say ""
say "WARNING: Since this may be your first time running this program, you"
say "had better look at the source code for this program before proceeding"
say "any further. This program may cause loss of data if you do not setup"
say "this program correctly!"
say ""
exit(30)
end
if ~ShowList('L', 'rexxsupport.library') then do
call AddLib("rexxsupport.library", 0, -30, 0)
end
/* Read in userids which should not be bounced. */
IdCnt = 0
Line = ReadLn('Fp')
do while ~eof('Fp')
IdCnt = IdCnt + 1
SafeId.IdCnt = Line
Line = ReadLn('Fp')
end
/* Read in file names in UUMAIL: directory. */
DirList = ShowDir(BouncerDir, "Files")
/* For each file found, process it. */
do i = 1 to Words(DirList)
File = Word(DirList, i)
/* Ignore any files ending in .o (created by Elm). */
if Right(File, 2) ~= ".o" then do
InList = 0
/* Look for userid in bounce list. */
do s = 1 to IdCnt
if (File == SafeId.s) then do
InList = 1
Break
end
end
/* If not in db/bounce.config, bounce it. */
if ~InList then do
/* This builds the email command (Elm) to be executed. */
Cmd = BouncerCmd || ' <' || BouncerDir || File || ' >NIL: -u '
Cmd = Cmd || BouncerId || ' -s "' || BouncerSubject || '"'
Cmd = Cmd || ' ' || BouncerDest
address command Cmd
call Delete(BouncerDir || File)
end
end
else do
if BouncerKill == 1 then do
call Delete(BouncerDir || File)
end
end
end
call Close('Fp')
Exit(0)